<template>
  <div>
    <!-- 附件表五 基本信息运输信息 add by qzn 20190711  -->
    <mt-header fixed title="道路货物运输量专项调查" style="z-index: 999999;">
      <span slot="left" @click="goBack">
        <mt-button icon="back" slot="left">返回</mt-button>
      </span>
      <mt-button  v-if="(reportedByOther==1&&information=='调查员'||reportedByOther==0&&information=='业户')" icon slot="right" @click.native="insertDate">新增</mt-button>
    </mt-header>
    <el-table border :data="tableData4" style="width: 100%" max-height="450">
      <el-table-column fixed prop="xh" label="序号" width="50" align="center"></el-table-column>
      <el-table-column prop="cphm" label="车牌号码" width="80" align="center"></el-table-column>
      <el-table-column prop="cpys" label="车牌颜色" width="80" align="center"></el-table-column>
      <el-table-column prop="tcxh" label="趟次序号" width="80" align="center"></el-table-column>
      <el-table-column prop="ksrq" label="开始日期" width="120"  align="center"></el-table-column>
      <el-table-column prop="jsrq" label="结束日期" width="120" align="center"></el-table-column>
      <el-table-column prop="qdddmc" label="起点地点名称" width="120" align="center"></el-table-column>
      <el-table-column prop="qdxzqhdm" label="起点行政区划代码" width="120" align="center"></el-table-column>
      <el-table-column prop="zdddmc" label="终点地点名称" width="120" align="center"></el-table-column>
      <el-table-column prop="zdxzqhdm" label="终点行政区划代码" width="120" align="center"></el-table-column>
      <el-table-column prop="hwzlmc" label="货物种类名称" width="120" align="center"></el-table-column>
      <el-table-column prop="hwzldm" label="详细货物名称" width="80" align="center"></el-table-column>
      <el-table-column prop="zhlc" label="载货里程（公里）" width="120" align="center"></el-table-column>
      <el-table-column prop="gsgllc" label="高速公路里程（公里）" width="120" align="center"></el-table-column>
      <el-table-column prop="hyl" label="货运量（吨）" width="120" align="center"></el-table-column>
      <el-table-column prop="hyzzl" label="货物周转量（吨公里）" width="120" align="center"></el-table-column>
      <el-table-column prop="jzxxyl" label="集装箱箱运量（TEU）" width="120" align="center"></el-table-column>
      <el-table-column prop="sr" label="收入（元）" width="120" align="center"></el-table-column>
      <el-table-column prop="jjfs" label="计价方式" width="120" align="center"></el-table-column>
      <el-table-column prop="cb" label="成本（元）" width="120" align="center"></el-table-column>
      <el-table-column label="操作" width="120" align="center">
        <template slot-scope="scope">
          <el-button
            v-if="(reportedByOther==1&&information=='调查员'||reportedByOther==0&&information=='业户')"
            @click.native.prevent="deleteRow(scope.$index, tableData4)"
            type="text"
            size="small"
          >移除</el-button>
          <el-button v-if="(reportedByOther==1&&information=='调查员'||reportedByOther==0&&information=='业户')" @click.native.prevent="updateRow(scope.$index)" type="text" size="small">修改</el-button>
        </template>
      </el-table-column>
    </el-table>
    <table style="margin:3%">
        <tr v-for = '(item,i) in errorMessage'>
             <td style="color:blue" @click="showInputPopup(item,i)">{{item}}</td>
        </tr>    
    </table>
    <mt-popup
      v-model="popupVisibleReason"
      popup-transition="popup-fade"
      closeOnClickModal="true"
      position="bottom">
      <div class="picker-toolbar-title" style="width:100%">
          <div class="usi-btn-cancel" @click="popupVisibleReason = !popupVisibleReason">取消</div>
          <div class="usi-btn-sure" @click="check">确定</div>
        </div>
      <div style="margin:8px">{{this.text}}</div>
      <el-input type="textarea" placeholder="请输入原因" v-model="reason" style="margin-bottom:10px;" rows="5"></el-input>
      
    </mt-popup>
  </div>
</template>
      
<script>
import { Toast, MessageBox } from "mint-ui";
export default {
  data() {
    return {
      //省市县
      provincesArray : '',
      cityArray : '',
      countyArray : '',

      iosProvincesName: "",
      iosCitysName: "",
      iosCountysName: "",

      errorMessage: [],
      numMessage: [],
      popupVisibleReason: false,//弹窗状态
      text:"",//公式
      numInfo:"",
      reason:"",
      xh: 0, //序号
      tableData4: [
        {
          recid: "",
          floatorder: "",
          xh: "0",
          cphm:'',// 车牌号码
          cpys:'',
          tcxh: "", // 趟次序号
          ksrq: "", // 开始日期
          jsrq: "", // 结束日期
          qdddmc: "", // 起点地点名称
          qdxzqhdm: "", //起点行政区划代码
          zdddmc: "", // 终点地点名称
          zdxzqhdm: "", // 终点行政区划代码
          hwzlmc: "", //货物种类名称
          hwzldm: "", //货物种类代码
          zhlc: "", // 载货里程（公里）
          gsgllc: "", // 高速公路里程（公里）
          hyl: "", // 货运量
          hyzzl: "", // 货物周转量
          jzxxyl: "", // 集装箱箱运量
          sr: "", // 收入
          jjfs: "", // 计价方式
          cb: "", // 成本
        }
      ],
      // 根据公司状态判定新增按钮是否显示 add by qzn 20190625
      reportedByOther: this.$route.query.reportedByOther,
       information:this.$route.query.information
    };
  },
  watch: {},
  mounted() {
    
    this. getCityData();
  },
  methods: {
    showInputPopup(item,i){
      if(JSON.stringify(item).indexOf("逻辑性") == -1){
        this.popupVisibleReason = true;
        console.log("名称："+JSON.stringify(item)+"编号："+this.numMessage[i]);
        this.text = JSON.stringify(item);
        this.numInfo = this.numMessage[i];
        this.getReason();
      }
    },
    checkStringLen(str){
      let flag = false;
      let len = 0;
      let len1 = 0;
      for (var i = 0; i < str.length; i++) {
          let length = str.charCodeAt(i);
          if(length>=0&&length<=128) {
              len += 1;                    
          } else {
              len1 += 2;                    
          }
      }
      if(len1 < 20){
          flag = true;
          console.log("原因长度"+len1);   
      }
      return flag;
    },
    check(){
      if(this.reason == "" || this.reason == undefined){
        Toast("原因不能为空！");
      } else if(this.checkStringLen(this.reason)){
        Toast("原因不能少于十个汉字！");
      } else {
        this.reasonSure();
      }
    },
    reasonSure(){
      console.log("输入原因："+this.reason);      
        this.axios
            .post(
              "http://zxdc.catsic.com:9090/sampling/errorStatement/saveErrorMessage",
              {
                data: {
                  formula: this.numInfo,
                  yhmlk: localStorage.getItem("id"),
                  errorDesc: this.reason,
                }
              },
              {
                headers: {
                  "Content-Type": "application/json",
                  mobileHeader:
                    '{"sessionId":' + localStorage.getItem("sessionId") + "}"
                }
              }
            )
            .then(result => {
              if (result.data.status === "1000") {
                console.log("审核原因:"+JSON.stringify(result));
                Toast("保存成功");
                this.popupVisibleReason = false;
              } else {
                Toast("保存失败");
              }
            });
    },
    getReason(){
        this.axios
            .post(
              "http://zxdc.catsic.com:9090/sampling/errorStatement/showErrorMessage",
              {
                data: {
                  formula: this.numInfo,
                  yhmlk: localStorage.getItem("id")
                }
              },
              {
                headers: {
                  "Content-Type": "application/json",
                  mobileHeader:
                    '{"sessionId":' + localStorage.getItem("sessionId") + "}"
                }
              }
            )
            .then(result => {
              console.log(result);
              if (result.data.status === "1000") {
                if(result.data.data.errorMessage == ""){
                  this.reason = "";
                } else {
                  this.reason = result.data.data.errorMessage.errordesc;
                }               
              }
            });
    },
    goBack() {
      //点击后退
      this.$router.go(-1);
    },
    getCode() {
      let data = {};
      data.yhmlkRecid = this.$route.query.yhmlk;
    //   console.log("yhmlkRecidGeeee-->" + data.yhmlkRecid);
      this.axios
        .post(
          "http://zxdc.catsic.com:9090/sampling/assit/findFzdcbfd06",
          { data: data },
          {
            headers: {
              "Content-Type": "application/json",
              mobileHeader:
                '{"sessionId":' + localStorage.getItem("sessionId") + "}"
            }
          }
        )
        .then(
          result => {
            if (result.data.status == "1000") {
                console.log("restlut-->>"+JSON.stringify(result))
              this.tableData4.splice(0);
              if( result.data.data.MSG != "没有查询到结果"){
                this.xh = '0';
                this.errorMessage = [];
                let baseInfo = JSON.parse(localStorage.getItem("baseInfo"));
                let infoLenght = localStorage.getItem("baseInfo").length;

                baseInfo.forEach(item => {
                  if(item.xslc != "" && item.xslc != undefined){
                    if(parseFloat(item.xslc) > 0){                      
                        let baseInfoCphm = item.cphm;
                        let flag = true;
                        result.data.data.Fzdcbfd06.forEach(item1 => {
                          if(baseInfoCphm == item1.fzdcbfd62019001){
                            flag = false;
                          }
                        })
                        if(flag){
                          this.errorMessage.push(" 逻辑性错误：车牌号为"+baseInfoCphm+"的车辆总行驶里程大于0，运输信息中缺少该车辆趟次信息，请修改！");
                          this.numMessage.push("---");
                        }
                    }
                  }
                });                

                //用来判断趟次序号是否从1开始
                let tcxhFlag=true

                  result.data.data.Fzdcbfd06.forEach(item => {
                    let tableData = {};
                    tableData.recid = item.recid;
                    tableData.floatorder = item.floatorder;
                    tableData.xh = ++this.xh;
                    (tableData.cphm = item.fzdcbfd62019001), // 车牌号码
                    (tableData.cpys = this.getCarColorName(item.plateColorCode)), // 车牌颜色
                    (tableData.tcxh = item.fzdcbfd62019002), // 趟次序号
                    (tableData.ksrq = item.fzdcbfd62019003), // 开始日期
                    (tableData.jsrq = item.fzdcbfd62019004), // 结束日期
                    (tableData.qdddmc =  this.getCityName(item.fzdcbfd62019005)), // 起点地点名称
                    (tableData.qdxzqhdm = item.fzdcbfd62019006), // 起点行政区划代码
                    (tableData.zdddmc = this.getCityName(item.fzdcbfd62019007)), // 终点地点名称
                    (tableData.zdxzqhdm = item.fzdcbfd62019008), // 终点行政区划代码
                    (tableData.hwzlmc = item.fzdcbfd62019009), // 货物种类名称
                    (tableData.hwzldm = item.fzdcbfd62019022), // 货物种类代码
                    (tableData.zhlc = item.fzdcbfd62019011), //载货里程
                    (tableData.gsgllc = item.fzdcbfd62019012), // 高速公路里程
                    //(tableData.nh = item.fzdcbfd52019013), // 能耗
                    (tableData.hyl = item.fzdcbfd62019013), // 货运量
                    (tableData.hyzzl = item.fzdcbfd62019014), // 货运周转量
                    (tableData.jzxxyl = item.fzdcbfd62019015), // 集装箱箱运量
                    (tableData.sr = item.fzdcbfd62019016), // 收入
                    (tableData.jjfs = this.getJjfsName(item.fzdcbfd62019017)), // 计价方式
                    (tableData.cb = item.fzdcbfd62019018), // 成本
                    this.tableData4.push(tableData);

                    //校验公式
                    if(tableData.cphm == ""){
                       this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：车牌号码不能为空，请修改！");
                       this.numMessage.push("[JUI6HUY6][FZB5]F1");
                    }
                    if(tableData.cphm != ""){
                      let flag = true;
                       baseInfo.forEach(item => {                          
                          if(item.cphm == tableData.cphm){
                              flag = false;
                              let bjdw = item.bjdw;
                              if(tableData.hyl != "" ){
                                  if(parseFloat(tableData.hyl)/parseFloat(bjdw) > 5){
                                    this.errorMessage.push("序号"+tableData.xh+" 核实性错误：货运量除以标记吨位应小于等于5，请核实！");
                                    this.numMessage.push("[JUI6HUY6][FZB5]F58");
                                  }
                              }
                              if(item.xslc == "" || item.xslc == undefined){
                                  this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：基本信息里的总行程里程大于0，请修改！");
                                  this.numMessage.push("[JUI6HUY6][FZB5]F25");
                              }else if(parseFloat(item.xslc) <= 0){
                                  this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：基本信息里的总行程里程大于0，请修改！");
                                  this.numMessage.push("[JUI6HUY6][FZB5]F25");
                              }   
                              console.log("调查期："+item.dcq+"起："+item.dcqq+"止："+item.dcqz);
                              if(tableData.jsrq != "" && tableData.jsrq != undefined){
                                let d = tableData.jsrq.split('/')[2];
                                if(item.dcq == "其他" && item.dcqq != undefined && item.dcqz != undefined){                                  
                                    let q = item.dcqq.split('/')[2];
                                    let z = item.dcqz.split('/')[2];                                
                                    console.log("结束日期："+d+"-"+q+"-"+z);
                                    if(parseInt(d)<parseInt(q) || parseInt(d)>parseInt(z)){
                                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：结束日期应在调查期对应的日期内，请修改！");
                                        this.numMessage.push("---");
                                    }
                                    
                                } else if(item.dcq == "上旬（1-10日）"){
                                    if(parseInt(d)<1 || parseInt(d)>10){
                                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：结束日期应在调查期对应的日期内，请修改！");
                                        this.numMessage.push("---");
                                    }
                                }  else if(item.dcq == "中旬（11-20日）"){
                                    if(parseInt(d)<11 || parseInt(d)>20){
                                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：结束日期应在调查期对应的日期内，请修改！");
                                        this.numMessage.push("---");
                                    }
                                }  else if(item.dcq == "下旬（21-30日）"){
                                    if(parseInt(d)<21 || parseInt(d)>30){
                                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：结束日期应在调查期对应的日期内，请修改！");
                                        this.numMessage.push("---");
                                    }
                                }  
                              }     

                          }
                       });                       
                       if(flag){this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：车牌号码必须为基本信息中的车牌号码，请修改！");
                       this.numMessage.push("[JUI6HUY6][FZB5]F25");}
                    }
                    if(tableData.cpys == "" || tableData.cpys == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：车牌颜色不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F2");
                    }
                    if(tableData.tcxh == "" || tableData.tcxh == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：趟次序号不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F26");
                    }
                    
                    if(tableData.tcxh == "1"){
                        tcxhFlag = false;
                        
                    }
                    if(tableData.ksrq == "" || tableData.ksrq == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：开始日期不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F27");
                    }
                    if(tableData.ksrq != "" && tableData.ksrq != undefined && tableData.tcxh != "" && tableData.tcxh != undefined){
                        if(tableData.tcxh != "1"){
                            let m = tableData.ksrq.split('/')[1];
                            if(m != "09"){
                                this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：开始日期除第一个趟次外，其余应在9月份，请修改！");
                                this.numMessage.push("---");
                            }
                        }
                    }
                    if(tableData.jsrq == "" || tableData.jsrq == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：结束日期不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F28");
                    }

                    if(tableData.ksrq != "" && tableData.ksrq != undefined){
                        console.log("开始日期："+tableData.ksrq.split('/')[1]);
                        console.log("当前月份："+this.getTime());
                        let m = tableData.ksrq.split('/')[1];
                        if(parseFloat(m)>parseFloat(this.getTime())){
                            this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：开始月份不能晚于当前调查月，请修改！");
                            this.numMessage.push("[JUI6HUY6][FZB5]F60");
                        }
                        if(tableData.jsrq != "" && tableData.jsrq != undefined){
                            let result = this.compareTimeNew(tableData.ksrq, tableData.jsrq);
                            if(result){
                                this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：结束日期应晚于或等于开始日期，请修改！");
                                this.numMessage.push("[JUI6HUY6][FZB5]F62");
                            }
                        }
                    }         
                    
                    if(tableData.jsrq != "" && tableData.jsrq != undefined){
                       let m = tableData.jsrq.split('/')[1];
                       if(m != "09"){
                          this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：结束日期应在9月份，请修改！");
                          this.numMessage.push("---");
                       }
                    }

                    if(tableData.qdddmc == "" || tableData.qdddmc == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：起点名称不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F29");
                    }
                    if(tableData.zdddmc == "" || tableData.zdddmc == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：终点名称不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F31");
                    }
                    if(tableData.hwzlmc == "" || tableData.hwzlmc == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：货物种类名称不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F33");
                    }
                    if(tableData.hwzlmc == "其他" && (tableData.hwzldm == undefined||tableData.hwzldm == "")){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：详细货物名称不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F34");
                    }
                    if(tableData.zhlc == "" || tableData.zhlc == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：载货里程（公里）不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F36");
                    }                    
                    if(tableData.hyl == "" || tableData.hyl == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：货运量（吨）不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F37");
                    }
                    if(tableData.hyzzl == "" || tableData.hyzzl == undefined){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：货物周转量（吨公里）不能为空，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F39");
                    }
                    if(tableData.hyl != "" && tableData.hyl != undefined && tableData.hyzzl != "" && tableData.hyzzl != undefined && tableData.zhlc != "" && tableData.zhlc != undefined){
                        if(parseFloat(tableData.hyl)*parseFloat(tableData.zhlc) < parseFloat(tableData.hyzzl)){
                            this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：货物周转量填写时，则需载货里程乘以货运量大于等于货物周转量，请修改！");
                            this.numMessage.push("---");
                        }
                    }                    
                    if((tableData.sr != "" && tableData.jjfs == "") || (tableData.sr == "" && tableData.jjfs != "")){
                        this.errorMessage.push("序号"+tableData.xh+" 逻辑性错误：收入和计价方式两者同时填写或同时不填，请修改！");
                        this.numMessage.push("[JUI6HUY6][FZB5]F50");
                    }

                    if(tableData.jzxxyl != "" && tableData.jzxxyl != undefined){
                        if(parseFloat(tableData.jzxxyl) >4){
                            this.errorMessage.push("序号"+tableData.xh+" 核实性错误：集装箱箱运量应小于等于4，请核实！");
                            this.numMessage.push("[JUI6HUY6][FZB5]F89");
                        }
                    }
                    if(tableData.zhlc != "" && tableData.zhlc != undefined){
                        if(parseFloat(tableData.zhlc) > 4000){
                            this.errorMessage.push("序号"+tableData.xh+" 核实性错误：载货里程应小于等于4000，请核实！");
                            this.numMessage.push("[JUI6HUY6][FZB5]F41");
                        }                        
                    }
              });
              if(tcxhFlag){
                  this.errorMessage.push(" 逻辑性错误：趟次序号从1开始依次填写，请修改！");
                  this.numMessage.push("---");
              }
              let len = result.data.data.Fzdcbfd06.length;
              let list = result.data.data.Fzdcbfd06;
              for(let i=0; i<len-1; i++){                   
                        if(list[i].fzdcbfd62019001 == list[i+1].fzdcbfd62019001){
                            if(parseInt(list[i+1].fzdcbfd62019002)-parseInt(list[i].fzdcbfd62019002)!=1){
                              this.errorMessage.push("序号"+(i+2)+" 逻辑性错误：同一辆车的趟次序号应连续，请修改！");
                              this.numMessage.push("---");
                            }
                            if(!this.compareTime(list[i+1].fzdcbfd62019003,list[i].fzdcbfd62019004)){
                              this.errorMessage.push("序号"+(i+2)+" 逻辑性错误：开始日期应在上一趟次结束日期之后，请修改！");
                              this.numMessage.push("---"); 
                            }
                        }

              }
              baseInfo.forEach(item => {
                let zzlc = 0;
                let zzlchj = 0;
                list.forEach(item1 => {
                  if(item.cphm == item1.fzdcbfd62019001){
                    zzlc += parseFloat(item1.fzdcbfd62019011);
                  }
                  if(item.cphm == item1.fzdcbfd62019001 && item.cpys == this.getCarColorName(item1.plateColorCode)){
                    let m = item1.fzdcbfd62019003.split('/')[1];
                       if(m == "09"){
                          zzlchj += parseFloat(item1.fzdcbfd62019011);
                       }
                  }
                });
                console.log(item.cphm+"-zzlc--"+zzlc);
                console.log(item.cphm+"-zzlchj--"+zzlchj);
                console.log(item.cphm+"-xslc--"+item.xslc);
                //console.log(item.xslc);
                //当总行驶里程=该车辆所有载重里程合计
                if(parseFloat(item.xslc) - zzlc == 0 && parseFloat(item.xslc) != 0){
                  console.log(item.cphm+"----");
                    console.log("当某一车辆的总行程里程等于该车辆的所有载重里程合计值");
                    for(let i=0; i<len-1; i++){
                      if(list[i].fzdcbfd62019001 == list[i+1].fzdcbfd62019001){
                        //当起点！=上一趟终点时
                        if(list[i].fzdcbfd62019008 != list[i+1].fzdcbfd62019006){
                          this.errorMessage.push("序号"+(i+2)+" 逻辑性错误：该车辆的总行程里程等于该车辆的所有载重里程合计值，则该车辆的起终点需要连续，即当前趟次的起点应等于上一趟次的终点，请修改！");
                          this.numMessage.push("---"); 
                        }
                      }
                    }
                }
                if(parseFloat(item.xslc) < zzlchj){
                    this.errorMessage.push(" 逻辑性错误：车牌号为"+item.cphm+"的总行驶里程应大于等于开始日期在调查期内的所有趟次载货里程合计，请修改！");
                    this.numMessage.push("---"); 
                }
              });
              
              }
            }
          },
          error => {
            console.log("getyhcars request error:" + error);
          }
        );
    //   console.log(this.$route.query.yhmlk);
    },
    insertDate() {
      this.$router.push({
        path: "/home/auxiliaryTableFiveTransportInfoInsert/:yhmlk",
        query: { yhmlk: this.$route.query.yhmlk }
      });
    },
    deleteRow(index) {
      let data = {};
      data.recid = this.tableData4[index].recid;
      console.log('recid-->>'+data.recid)
      this.axios
        .post(
          "http://zxdc.catsic.com:9090/sampling/assit/deleteFzdcbfd06",
          { data: data },
          {
            headers: {
              "Content-Type": "application/json",
              mobileHeader:
                '{"sessionId":' + localStorage.getItem("sessionId") + "}"
            }
          }
        )
        .then(
          result => {
            if (result.data.status == "1000") {
              this.getCode();
              console.log(result);
            }
          },
          error => {
            console.log("getyhcars request error:" + error);
          }
        );
      console.log(index, this.tableData4[index]);
      this.getCode();
    },
    updateRow(index) {
      this.$router.push({
        path: "/home/auxiliaryTableFiveTransportInfoUpdate/:yhmlk/:recid/:floatorder",
        query: {
          yhmlk: this.$route.query.yhmlk,
          recid: this.tableData4[index].recid,
          floatorder: this.tableData4[index].floatorder
        }
      });
      console.log(index, this.tableData4[index]);
    }, 
    //获取时间
    getTime() {
      var date = new Date();
      var seperator1 = "-";
      var year = date.getFullYear();
      var month = date.getMonth() + 1;
      var strDate = date.getDate();
      if (month >= 1 && month <= 9) {
        month = "0" + month;
      }
      if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
      }
      var currentdate = year + seperator1 + month + seperator1 + strDate;
      var m = month;
      return m;
    },
    //比较时间大小
    compareTime(beginDate, endDate) {
      var beginDate = beginDate;
      var endDate = endDate;
      var d1 = new Date(beginDate.replace(/\-/g, "/"));
      var d2 = new Date(endDate.replace(/\-/g, "/"));
      if (d1 >= d2) {
        return true;
      } else {
        return false;
      }
    },
    compareTimeNew(beginDate, endDate) {
      var beginDate = beginDate;
      var endDate = endDate;
      var d1 = new Date(beginDate.replace(/\-/g, "/"));
      var d2 = new Date(endDate.replace(/\-/g, "/"));
      if (d1 > d2) {
        return true;
      } else {
        return false;
      }
    },
    // 获取车牌颜色名称
                getCarColorName(code) {
                  var goodsTypes = [
                    {
                      code: "1",
                      name: "蓝色"
                    },
                    {
                      code: "2",
                      name: "黄色"
                    },
                    {
                      code: "3",
                      name: "黑色"
                    },
                    {
                      code: "4",
                      name: "白色"
                    },
                    {
                      code: "5",
                      name: "黄绿"
                    },
                    {
                      code: "6",
                      name: "渐变绿"
                    },
                    {
                      code: "9",
                      name: "其他"
                    }
                  ];
                  var name = "";
                  goodsTypes.forEach(item => {
                    if (item.code === code) {
                      name = item.name;
                    }
                  });
                  return name;
              },
    getJjfsName(code) {
                  var goodsTypes = [
                    {
                      code: "1",
                      name: "整车计"
                    },
                    {
                      code: "2",
                      name: "体积计"
                    },
                    {
                      code: "3",
                      name: "重量计"
                    },
                    {
                      code: "9",
                      name: "其他"
                    }
                  ];
                  var name = "";
                  goodsTypes.forEach(item => {
                    if (item.code === code) {
                      name = item.name;
                    }
                  });
                  return name;
              },
    getGoodsTypeNmae(code) {// 获取货物类型名称显示在表格 add by qzn 20190704  
      var goodsTypes = [
        {
          code: "1",
          name: "煤炭及制品"
        },
        {
          code: "2",
          name: "金属矿石"
        },
        {
          code: "3",
          name: "矿建材料及水泥"
        },
        {
          code: "4",
          name: "机械设备电器"
        },
        {
          code: "5",
          name: "轻工医药产品"
        },
        {
          code: "6",
          name: "鲜活农产品"
        },
        {
          code: "9",
          name: "其他"
        }
      ];
      var name;
      goodsTypes.forEach(item => {
        if (item.code === code) {
          name = item.name;
        }
      });
      return name;
    },
    getCityData(){
                  
                  //console.log(this.reportedByOther+this.information);
                    // Indicator.open({
                    //   text: '加载数据...',
                    //   spinnerType: 'fading-circle'
                    // });
                    this.axios.get("http://zxdc.catsic.com:9090/sampling/json/city").then( 
                        response => {
                            

                            this.provincesArray = response.data.iosProvinces;
                            this.cityArray = response.data.iosCitys;
                            this.countyArray = response.data.iosCountys;
                            
                             this.getCode();
                             //this.getCode();
                        },
                        response => {
                            console.log("数据加载失败");
                        }
                    );
                },
                getCityName(code){
                  let countyParentId = '', cityParentId = '';
                            
                            for(let i=0; i<this.countyArray.length; i++){
                                if(code == this.countyArray[i].id){
                                    this.iosCountysName = this.countyArray[i].value;
                                    countyParentId = this.countyArray[i].parentId;           
                                }
                            }
                            for(let j=0; j<this.cityArray.length; j++){
                                if(countyParentId == this.cityArray[j].id){
                                    this.iosCitysName = this.cityArray[j].value;
                                    cityParentId = this.cityArray[j].parentId;                                    
                                }
                            }
                            for(let n=0; n<this.provincesArray.length; n++){
                                if(cityParentId == this.provincesArray[n].id){
                                    this.iosProvincesName = this.provincesArray[n].value;                                  
                                }
                            }
                            return (this.iosProvincesName+"-"+this.iosCitysName+"-"+this.iosCountysName);
                },
  }
};
</script>

</script>
 <style lang="scss" scoped>
.tb {
  padding-top: 10px;
}

.mint-cell {
  background-color: #efeff4;
}
input[type="number"] {
  line-height: 21px;
  width: 100%;
  height: 40px;
  margin-bottom: 0px;
  padding: 10px 15px;
  -webkit-user-select: text;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  outline: 0;
  background-color: #fff;
  -webkit-appearance: none;
}
.button {
  padding-top: 3%;
  padding-left: 5%;
  padding-right: 5%;
  padding-bottom: 5%;
}
.picker-toolbar-title {
  display: flex;
  flex-direction: row;
  background-color: #007aff;
  justify-content: space-around;
  height: 40px;
  line-height: 40px;
  font-size: 16px;
  width: 100%;
}
.usi-btn-cancel,
.usi-btn-sure {
  color:white;
}
.mint-popup-bottom {
  width: 100%;
  top: auto;
  right: auto;
  bottom: 0;
}
</style>